using Cleverscape.UTorrentClient.WebClient;

namespace uTorrentNetClient.ModelDesign.Helper
{
    public class TorrentFileDecorator :  Base
    {
        private TorrentFile torrentFile;

        public TorrentFileDecorator(TorrentFile file)
        {
            torrentFile = file;
            Name = file.Name;
            TotalFileSize = file.SizeTotalFormatted;
            TotalFileSizeDownloaded = file.SizeDownloadedFormatted;
            Priority = file.Priority;

            ResetChanges();
        }

        
        public string Name { get; private set; }
        public string TotalFileSize { get; private set; }
        public string TotalFileSizeDownloaded { get; private set; }

        private FilePriority _priority;
        public FilePriority Priority
        {
            get { return _priority; }
            set
            {
                setHasChanges(_priority, value);
                _priority = value;
                SetNotifyPropertyChanged("Priority");
            }
        }

        public void SaveChanges()
        {
            torrentFile.Priority = Priority;
            ResetChanges();
        }
    }
}